package service.impl;

import bean.dto.OrderDto;
import bean.dto.OrderDto2;
import bean.vo.OrderVo;
import dao.OrderDao;
import dao.impl.OrderDaoImpl;
import service.OrderService;

import java.util.List;

/**
 * service.impl
 * User: 李雨行
 * Date: 2024/12/18 14:28
 * motto:   沉淀哥
 * Description:
 * Version: V1.0
 */
public class OrderServiceImpl implements OrderService {
    private OrderDao orderDao=new OrderDaoImpl();
    @Override
    public List<OrderVo> findByPage(Integer orderId, String userName,String productName, Integer page, Integer limit) {
        if (userName!=null && userName.trim().length()==0){
            userName=null;
        }
        if (productName!=null && productName.trim().length()==0){
            productName=null;
        }
        return orderDao.findByPage(orderId,userName,productName,page,limit);
    }

    @Override
    public boolean add(OrderDto orderDto) {
        return orderDao.add(orderDto);
    }

    @Override
    public Integer maxPage(Integer orderId, String userName, String productName) {
        return orderDao.maxPage(orderId,userName,productName);
    }

    @Override
    public boolean deleteById(Integer orderId) {
        return orderDao.deleteById(orderId);
    }

    @Override
    public boolean add2(OrderDto2 orderDto2) {
        return orderDao.add2(orderDto2);
    }

    @Override
    public boolean change(Integer orderId) {
        return orderDao.change(orderId);
    }
}
